package com.wmh.baseservice.common.controller;

import com.wmh.baseservice.common.annotation.parameterverify.ParameterVerify;
import com.wmh.baseservice.common.utils.returnbody.ReturnBody;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import java.text.SimpleDateFormat;

/**
 * @author
 */
@RestController
@RequestMapping(value = {"common"}, produces = "text/plain;charset=utf-8")
@Api(tags = "公共模块")
public class CommonController {

    @ApiOperation("图片上传")
    @PostMapping({"us/upload/image"})
    @ParameterVerify(notNull = "file")
    public String upload(MultipartFile file, HttpServletRequest request){
        SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd");
//        String path = FileUtil.upload("/article/" + format.format(new Date()) + "/", file, "image", request);
//        return ReturnBody.success(path);
        return ReturnBody.error();
    }

}
